home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / kernel / table.c < prev    next >
C/C++ Source or Header  |  1990-07-23  |  4KB  |  120 lines

  1. /* The object file of "table.c" contains all the data.  In the *.h files, 
  2.  * declared variables appear with EXTERN in front of them, as in
  3.  *
  4.  *    EXTERN int x;
  5.  *
  6.  * Normally EXTERN is defined as extern, so when they are included in another
  7.  * file, no storage is allocated.  If the EXTERN were not present, but just
  8.  * say,
  9.  *
  10.  *    int x;
  11.  *
  12.  * then including this file in several source files would cause 'x' to be
  13.  * declared several times.  While some linkers accept this, others do not,
  14.  * so they are declared extern when included normally.  However, it must
  15.  * be declared for real somewhere.  That is done here, by redefining
  16.  * EXTERN as the null string, so the inclusion of all the *.h files in
  17.  * table.c actually generates storage for them.  All the initialized
  18.  * variables are also declared here, since
  19.  *
  20.  * extern int x = 4;
  21.  *
  22.  * is not allowed.  If such variables are shared, they must also be declared
  23.  * in one of the *.h files without the initialization.
  24.  */
  25.  
  26. #define _TABLE
  27.  
  28. #include "kernel.h"
  29. #include <minix/com.h>
  30. #include "proc.h"
  31. #include "tty.h"
  32.  
  33. /* The startup routine of each task is given below, from -NR_TASKS upwards.
  34.  * The order of the names here MUST agree with the numerical values assigned to
  35.  * the tasks in <minix/com.h>.
  36.  */
  37. #define SMALL_STACK    (128 * sizeof (char *))
  38.  
  39. #if (MACHINE == ATARI)
  40. #define    TTY_STACK    (2 * SMALL_STACK)
  41. #define IDLE_STACK    SMALL_STACK
  42. #else
  43. #define    TTY_STACK    SMALL_STACK
  44. #define    IDLE_STACK    (3 * 2 + 3 * 2 + 4 * 2)    /* 3 intr, 3 temps, 4 db */
  45. #endif
  46. #define    PRINTER_STACK    SMALL_STACK
  47. #define    WINCH_STACK    SMALL_STACK
  48. #define    FLOP_STACK    (3*SMALL_STACK/2)
  49. #define    MEM_STACK    SMALL_STACK
  50. #define    CLOCK_STACK    SMALL_STACK
  51. #define    SYS_STACK    SMALL_STACK
  52. #define    HARDWARE_STACK    0        /* dummy task, uses kernel stack */
  53.  
  54.  
  55.  
  56. #if AM_KERNEL
  57. #    define    AMINT_STACK        SMALL_STACK
  58. #    define    AMOEBA_STACK        1532
  59. #    define    AMOEBA_STACK_SPACE    (AM_NTASKS*AMOEBA_STACK + AMINT_STACK)
  60. #else
  61. #    define    AMOEBA_STACK_SPACE    0
  62. #endif
  63.  
  64. #define    TOT_STACK_SPACE        (TTY_STACK + AMOEBA_STACK_SPACE + \
  65.                  IDLE_STACK + HARDWARE_STACK + \
  66.                  PRINTER_STACK + WINCH_STACK + FLOP_STACK + \
  67.                  MEM_STACK + CLOCK_STACK + SYS_STACK)
  68.  
  69. /*
  70. ** some notes about the following table:
  71. **  1) The tty_task should always be first so that other tasks can use printf
  72. **     if their initialisation has problems.
  73. **  2) If you add a new kernel task, add it after the amoeba_tasks and before
  74. **     the printer task.
  75. **  3) The task name is used for process status (F1 key) and must be six (6)
  76. **     characters in length.  Pad it with blanks if it is too short.
  77. */
  78.  
  79. PUBLIC struct tasktab tasktab[] = {
  80.     tty_task,        TTY_STACK,    "TTY   ",
  81. #if AM_KERNEL
  82.     amint_task,        AMINT_STACK,    "AMINT ",
  83.     amoeba_task,        AMOEBA_STACK,    "AMTASK",
  84.     amoeba_task,        AMOEBA_STACK,    "AMTASK",
  85.     amoeba_task,        AMOEBA_STACK,    "AMTASK",
  86.     amoeba_task,        AMOEBA_STACK,    "AMTASK",
  87. #endif
  88.     idle_task,        IDLE_STACK,    "IDLE  ",
  89.     printer_task,        PRINTER_STACK,    "PRINTR",
  90.     winchester_task,    WINCH_STACK,    "WINCHE",
  91.     floppy_task,        FLOP_STACK,    "FLOPPY",
  92.     mem_task,        MEM_STACK,    "RAMDSK",
  93.     clock_task,        CLOCK_STACK,    "CLOCK ",
  94.     sys_task,        SYS_STACK,    "SYS   ",
  95.     0,            HARDWARE_STACK,    "HARDWA",
  96.     0,            0,        "MM    ",
  97.     0,            0,        "FS    ",
  98.     0,            0,        "INIT  "
  99. };
  100.  
  101. PUBLIC char t_stack[TOT_STACK_SPACE + ALIGNMENT - 1];    /* to be aligned */
  102.  
  103. /*
  104. ** The number of kernel tasks must be the same as NR_TASKS.
  105. ** If NR_TASKS is not correct then you will get the compile error:
  106. **   multiple case entry for value 0
  107. ** The function ___dummy is never called.
  108. */
  109.  
  110. #define NKT (sizeof tasktab / sizeof (struct tasktab) - (INIT_PROC_NR + 1))
  111. PUBLIC void ___dummy()
  112. {
  113.     switch(0)
  114.     {
  115.     case 0:
  116.     case (NR_TASKS == NKT):
  117.         ;
  118.     }
  119. }
  120.